/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * Projects
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 * 
 * Projects is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Projects is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#include "ActivityHistory.hpp"

int main (int argc, char *argv[])
{
    if(argc == 4)
    {
        if(std::string(argv[1]) == "read")
        {
            ///@brief Testing reading of a history file
            ActivityHistory history;
            history.ReadHistoryFile(std::string(argv[3]), std::string(argv[2]));
            ///@brief Check if we have the right number of laps (given file contains 9 laps)
            if(history.GetNumberOfLaps() != 9)
            {
                return 1;
            }
            /*///@brief Check the number of points in lap 1 (it sould be 301)
            if(history.GetLapHistory(0).GetNumberOfPoints() != 301)
            {
                return 1;
            }*/
            ///@brief Check the average power (it should be 185)
            double power = history.ComputeAveragePower();
            if((power <= 184.)||(power >= 186))
            {
                return 1;
            }
            
            
            
            
            
            return 0;
            
        }
        
        
        
    }
    
    return 0;
}